<?php
namespace app\controller;

use app\lib\pay\weixin\lib\database\WxPayUnifiedOrder;
use app\lib\pay\weixin\lib\WxPayNativePay;

class Pay extends AuthBase{
    public function index() {
        $d = date('YmdHis');
        $notify = new WxPayNativePay();
        $input = new WxPayUnifiedOrder();
        $input->SetBody('tp商城');
        $input->SetAttach('欢迎选购');
        $input->SetOut_trade_no('TPPAY'.$d);
        $input->SetTotal_fee('1');
        $input->SetTime_start($d);
        $input->SetTime_expire($d, time() + 300);
        $input->SetGoods_tag("test");
        $input->SetNotify_url("https://pay.singwa666.com/pay/notify/weixin");
        $input->SetTrade_type("NATIVE");
        $input->SetProduct_id("123456789");

        $result = $notify->GetPayUrl($input);
        halt($result);exit;
        $url2 = $result['code_url'];
        echo "<img src='".url("qcode/index", ["data"=>$url2])."'>";exit;
    }
}